#include "Aquarium_Devices.h";

extern Aquarium_Devices aquarium_devices;

prog_char device_name_0[] PROGMEM = "Refugee";
prog_char device_name_1[] PROGMEM = "Main Pump";
prog_char device_name_2[] PROGMEM = "tornado";
prog_char device_name_3[] PROGMEM = "Skimmer";
prog_char device_name_4[] PROGMEM = "Heater";
prog_char device_name_5[] PROGMEM = "UV";
prog_char device_name_6[] PROGMEM = "Device 7";
prog_char device_name_7[] PROGMEM = "Lighting T5";
prog_char device_name_8[] PROGMEM = "Skimmer Clean";
prog_char device_name_9[] PROGMEM = "Wave Pump Sump";
prog_char device_name_10[] PROGMEM = "Change Heater";
prog_char device_name_11[] PROGMEM = "Change Pump";
prog_char device_name_12[] PROGMEM = "Moon Night";
prog_char device_name_13[] PROGMEM = "Device 14";
prog_char device_name_14[] PROGMEM = "Wave Pump 0";
prog_char device_name_15[] PROGMEM = "Wave Pump 1";

PROGMEM const char *device_name_table[] = 
{   
  device_name_0,
  device_name_1,
  device_name_2,
  device_name_3,
  device_name_4,
  device_name_5,
  device_name_6,
  device_name_7,
  device_name_8,
  device_name_9,
  device_name_10,
  device_name_11,
  device_name_12,
  device_name_13,
  device_name_14,
  device_name_15,  
  
  
};



Aquarium_Devices::Aquarium_Devices() {

  aquarium_device_arr[0].init(0,14 );
  aquarium_device_arr[1].init(1,15 );
  
  for(byte i = 2 ; i <  NUMBER_OF_DEVICES ; ++i ){
    aquarium_device_arr[i].init(i,devices_pin_num-2+i );
  }

  for(byte i = 0 ; i <  NUMBER_OF_DEVICES ; ++i ){
    aquarium_device_arr[i].update();
  }
  

}

Aquarium_Device Aquarium_Devices::Get_Aquarium_Device(int index){
  return aquarium_device_arr[index];
}

bool Aquarium_Devices::Set_Aquarium_Device(int index , Aquarium_Device aquarium_device ){
  aquarium_device_arr[index] = aquarium_device;
  aquarium_device_arr[index].Save_To_EEPROM();
  aquarium_device_arr[index].update();
  return true;
}

void Aquarium_Devices::update_devices(){
  for(byte i = 0 ; i <  NUMBER_OF_DEVICES ; ++i ){
    aquarium_device_arr[i].update();
  }
}











